package com.fjec.market.controller;

import com.fjec.common.protocol.JsonResult;
import com.fjec.market.entity.BizPurchasing;
import com.fjec.market.service.IBizPurchasingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 007.采购商采购需求表 前端控制器
 * </p>
 *
 * @author admin
 * @since 2020-09-14
 */
@RestController
@RequestMapping("/")
public class BizPurchasingController {
    @Autowired
    IBizPurchasingService bizPurchasingService;

    @PostMapping(value = "/y/purchasing/save")
    public JsonResult savePurchasing(BizPurchasing bizPurchasing, Long userId) {
        return bizPurchasingService.savePurchasing(bizPurchasing, userId);
    }

    @GetMapping(value = "/y/purchasing/getMine")
    public JsonResult getMyPurchasing() {
        return bizPurchasingService.getMyPurchasing();
    }

    @PostMapping("/y/purchasing/delete")
    public JsonResult deletePurchasing(Long id) {
        bizPurchasingService.removeById(id);
        return JsonResult.SUCCESS;
    }
}
